package com.learn.file;

import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;

public class TestTransition {
    public static void main(String[] args) throws Exception{
//        FileReader fr = new FileReader("a.txt");
        InputStreamReader isr = new InputStreamReader(new FileInputStream("a.txt"),"gbk");

        char [] c = new char[100];
        int b;
        while((b=isr.read(c))!=-1){
            System.out.print(new String(c,0,b));
        }
        isr.close();
        System.out.println("------------------------------------->");

        OutputStreamWriter osw = new OutputStreamWriter(new FileOutputStream("gbk.txt"),"utf-8");
        osw.write("i好");
        osw.write("阿萨德阿萨德");
        osw.write("转换流");
        osw.close();


    }
}
